package samsung.sds.roleManagement.service;

import java.util.List;

import samsung.sds.roleManagement.model.RoleManagementEntity;
import samsung.sds.roleManagement.model.RoleToResEntity;
import samsung.sds.roleManagement.model.UserToRoleEntity;
import samsung.sds.system.common.baseQuery.BaseServiceInterface;
import samsung.sds.system.common.baseQuery.model.PageData;
import samsung.sds.system.common.model.QueryParam;
import samsung.sds.userManagement.model.UserEntity;

/**
 * 
 * @author fei3.liu
 * @updateDate 2016-01-26
 * roleManagement的service组件
 */

public interface RoleManagementService extends BaseServiceInterface<RoleManagementEntity> {
	
	/**
	 * Get table of SYS_USER_TO_ROLR data by role_name
	 * Data used to determine whether the role of the deletion and user association
	 * 根据角色名称查询SYS_USER_TO_ROLR表中的数据，用与判断角色被用户引用
	 * 
	 * @param id
	 * @return
	 */
	public List<UserToRoleEntity> queryUserByRoleName(String role_name);
	
	/**
	 * Get table of SYS_ROLE_TO_RES data by role_name
	 * Data used to determine whether a deleted role is associated with a resource
	 * 根据角色名称查询SYS_ROLE_TO_RES表中的数据，用与判断角色被资源引用
	 * 
	 * @param id
	 * @return
	 */
	public List<RoleToResEntity> queryResByRoleName(String role_name);

	/**
	 * Initialization viewUserPopup.jsp by role_name
	 * 查询拥有此角色的用户
	 * 
	 * @param role_name
	 * @return
	 */
	public PageData<UserEntity> queryUserListByRoleNameListPage(QueryParam param);

	/**
	 * Query User List Except RoleName
	 * 查询不拥有此角色的用户
	 * 
	 * @param param
	 * @return
	 */
	public PageData<UserEntity> queryUserListExceptRoleNameListPage(QueryParam param);

	/**
	 * The role of the lifting of the relationship with the user
	 * 解除角色与用户之间的关联，即从SYS_USER_TO_ROLR删除数据
	 * 
	 * @param t
	 * @return
	 */
	public String deleteUserToRole(String unameAndRname);
	
	/**
	 * 根据用户名称解除角色与用户之间的关联
	 * 
	 * @param t
	 * @return
	 */
	public int deleteRoleByUserName(String username);

	/**
	 * add role to user
	 * 给角色添加用户
	 * 
	 * @param userToRoleEntity
	 * @return
	 */
	public String insertUserToRole(String userToRoleData);
	
	/**
	 * 得到除已有角色之外的所有角色集合
	 * @return 
	 */
	public List<RoleManagementEntity> getResToRoleList(String id);
	
	/**
	 * Query UserRole By UserName
	 * 根据用户名获取当前用户的角色
	 * 
	 * @param userName
	 * @return
	 */
	public List<String> getUserRoleByUserName(String userName);
}
